package org.aitrade.kline;

import java.text.SimpleDateFormat;
import java.util.List;

import org.apache.log4j.Logger;

import com.tokenmaster.aitrade.RunKLine_okex;
import com.tokenmaster.aitrade.common.system.KLinePoint;
import com.tokenmaster.aitrade.market.okex.IOkex_Parameter.Types_Enum;
import com.tokenmaster.aitrade.trade.KLinesManager;
import com.tokenmaster.aitrade.trade.kdj.Index_KDJ;
import com.tokenmaster.aitrade.trade.kdj.Index_KDJ_Info;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) {

		KLinesManager kLinesManager = new KLinesManager();
		Logger logger = Logger.getLogger(RunKLine_okex.class);
		SimpleDateFormat sformat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");

		Index_KDJ index_KDJ = new Index_KDJ();

		while (true) {
			try {
				// 每隔5秒取一次行情
				String timestr = sformat.format(System.currentTimeMillis());
				logger.info("Get new KLine from : " + timestr);

				kLinesManager.checkNewKLine("btc_usdt", Types_Enum.MIN5);

				Thread.sleep(5000);

				kLinesManager.checkNewKLine("btc_usdt", Types_Enum.MIN15);

				Thread.sleep(5000);

				kLinesManager.checkNewKLine("btc_usdt", Types_Enum.HOUR4);

				Thread.sleep(5000);

				kLinesManager.checkNewKLine("eth_usdt", Types_Enum.MIN5);

				Thread.sleep(5000);

				kLinesManager.checkNewKLine("eth_usdt", Types_Enum.MIN15);

				Thread.sleep(5000);

				kLinesManager.checkNewKLine("eth_usdt", Types_Enum.HOUR4);

				Thread.sleep(5000);

			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
